import { Effect } from 'dva';
import { Reducer } from 'redux';

export interface CommonModelType {
  namespace: 'common';
  state: CommonState;
  effects: {
    clearAllCommonSaga: Effect;
    getUserMenuSaga: Effect;
    getOrgTreeDataSaga: Effect;
    getUserInfoSaga: Effect;
  };
  reducers: {
    clearCommon: Reducer;
    saveUserMenu: Reducer<CommonState>;
    getOrgTree: Reducer<any>;
    getUserInfo: Reducer<UserInfo>;
  };
}

export interface CommonState {
  userMenu?: any;
}

export interface UserInfo {
  org: {
    orgName: string;
  };
  user: {
    id: string;
    icon: string;
    userName: string;
    userCode: string;
    orgName: string;
    grade: string;
    mobile: string;
  };
  [propsNames: string]: any;
}